package cn.kilo.domain.model.order.entity;

import cn.kilo.types.common.Constants;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author kilok
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderEntity {

    private Long orderId;

    private String userId;

    private String userName;
    //用户需求
    private String orderInfo;

    private Integer distance;

    //需求图片
    private String orderInfoPicture;

    private String sorter1;

    private String sorter2;

    private Long fTimer;

    private Long sTimer;

    private String guard;

    private String start;

    private String end;

    private String ridgepole;//第几栋

    private LocalDateTime fStartTime;

    private LocalDateTime fEndTime;

    private LocalDateTime sStartTime;

    private LocalDateTime sEndTime;
    /**
     * 当前订单状态
     */
    private String status;

    private String picture;

    private String type;

    private String role;

    private String phoneNumber;

    private String orderCode;

    private String orderNumber;

    private Integer price;

    private Integer number;

    private LocalDateTime endTime;

    /**
     * 判断当前的楼层是否正确
     * @param floor
     * @return
     */
    public boolean checkFloor(int floor){
        String[] split=end.split(Constants.UNDERLINE);
        return floor >= Integer.parseInt(split[0]);
    }
}
